package com.xingda.packing.dmss.enums;

import lombok.Getter;

public enum BoxLocationNo {
    BOX01(1, 1, 1),
    BOX02(2, 2, 2),
    BOX03(3, 3, 3),
    BOX04(4, 4, 4),
    BOX05(5, 5, 5),
    BOX06(6, 6, 6),
    BOX07(7, 1, 12),
    BOX08(8, 2, 11),
    BOX09(9, 3, 10),
    BOX10(10, 4, 9),
    BOX11(11, 5, 8),
    BOX12(12, 6, 7),
    BOX99(99, 99, 99);

    @Getter
    private final int id;
    @Getter
    private final int no;
    @Getter
    private final int agv;

    BoxLocationNo(
            int id, int no, int agv) {
        this.id = id;
        this.no = no;
        this.agv = agv;
    }

    public static BoxLocationNo getById(int id) {
        for (BoxLocationNo value : BoxLocationNo.values()) {
            if (value.getId() == id) {
                return value;
            }
        }
        return BOX99;
    }

    public static BoxLocationNo getByAgv(int agv) {
        for (BoxLocationNo value : BoxLocationNo.values()) {
            if (value.getAgv() == agv) {
                return value;
            }
        }
        return BOX99;
    }
}
